package com.unknowpupil.design.flyweight;

/**
 * @Description: <p>
 *
 * </p>
 * @Author: <a> w10g </a>
 * @CreateDate: Create in 2020/4/28 11:13
 * @Classname: Client
 * @Version: 1.0
 */
public class Client {
    public static void main(String[] args) {
        ChessFlyWeight chess1 =  ChessFlyWeightFactory.getChess("黑色");
        ChessFlyWeight chess2 = ChessFlyWeightFactory.getChess("黑色");
        System.out.println(chess1);
        System.out.println(chess2);
        /**
         * 同样的对象。
         * com.unknowpupil.design.flyweight.ConcreteChess@1b6d3586
         * com.unknowpupil.design.flyweight.ConcreteChess@1b6d3586
         */
        System.out.println("增加外部状态处理==============");
        chess1.display(new Coordinate(10,20));
        chess2.display(new Coordinate(30,20));
        System.out.println(chess1);
        System.out.println(chess2);
    }
}
